<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

<div>
	<form id="infoForm" target="hiddenFrame" action="${path}/mc/rolesaveInfo" method="post" enctype="multipart/form-data">
		<fieldset style="padding-left: 10px;">
		  	<input type="hidden" name="entity.id" value="${entity.id}" />
		  	<input type="hidden" id="hidAuthIdStr" name="authIdStr" value="${authIdStr}" />
			<table>
			  	<tr>
			  		<td>角色名称</td>
			  		<td>
			  			<input type="text" name="entity.name" value="${entity.name}" class="{required:true,messages:{required:'请输入角色名称'}}" />
			  		</td>
			  	</tr>
		   </table>
		</fieldset>
	</form>
</div>
<div>
	<c:import url="/mc/permission/auth/search.jsp" />
	<table id="tblDetailAuth"></table>
</div>
<script type="text/javascript">
	$(function(){
		$(".detail #infoForm").submit(function(){
			var ids = [];
			var cbxChoosedAuth = $(".detail .bDiv :checkbox:checked");
			if(cbxChoosedAuth.length === 0) {
				hiAlert("请选择权限！", "提示");
				return false;
			}
			//保存选中的权限id
			cbxChoosedAuth.each(function(){
				ids.push($(this).val());
			});
			//拼接权限id并设置
			var choosedAuthMixStr = ids.join(",");
			$("#hidAuthIdStr").val(choosedAuthMixStr);
			return true;
		});
	});
</script>
